<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link href="/Public/css/bootstrap.min.css" rel="stylesheet">
    <script src="/Public/js/bootstrap.min.js"></script>
    <script src="/Public/js/jquery-1.11.1.min.js"></script>
    <style>
        .m{
            display: none;
        }
        .n{
            display: none;
        }
    </style>
</head>
<body>
    <div class="modal-dialog" style="width:450px;">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">&times;</button>
                <span class="glyphicon glyphicon-user"></span><span class="dl">登录ATM</span>
            </div>
            <form class="form-horizontal" action="">
                <div class="modal-body">
                    <div class="m">
                        <div class="alert  alert-success">恭喜！注册成功<button class="close" data-dismiss="alert">&times;</button></div>
                    </div>
                    <div class="n">
                        <div class="alert  alert-danger">该账号已被注册!<button class="close" data-dismiss="alert">&times;</button></div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-2">登录名</label>
                        <div class="col-xs-9">
                            <div class="input-group">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-user"></span>
                                </span>
                                <input type="text" class="form-control" required="required" name="login">
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-xs-2">密&nbsp;&nbsp;&nbsp;&nbsp;码</label>
                        <div class="col-xs-9">
                            <div class="input-group">
                                <span class="input-group-addon">
                                    <span class="glyphicon glyphicon-lock"></span>
                                </span>
                                <input type="password" class="form-control" required="required" name="psw">
                            </div>
                        </div>
                    </div>
                </div>
            </form>
                <div class="modal-footer">
                    <span>
                        <input type="button" class="btn btn-danger" id="登录" value="登录" onClick="l(this.id)">
                    </span>

                    <span>
                        <input type="button" class="btn btn-primary" value="注册" onClick="f(this.id)" id="注册">
                    </span>
                </div>
        </div>
    </div>

    <!--<div class="atm">-->
        <!--<div style="width: 20%;margin: auto;margin-top: 100px;">-->
            <!--<div class="panel panel-primary">-->
                <!--<div class="panel-heading">-->
                    <!--<span class="glyphicon glyphicon-user"></span>-->
                    <!--<span>ATM</span>-->
                <!--</div>-->
                <!--<div class="panel-body">-->
                    <!--<button class="btn btn-primary btn-lg" type="button" style="margin-left: 20px" data-toggle="modal" data-target="#jj">存款</button>-->
                        <!--<button class="btn btn-primary btn-lg" type="button" style="margin-left: 10px" data-toggle="modal" data-target="#k">-->
                            <!--取款-->
                        <!--</button>-->
                        <!--<button class="btn btn-primary btn-lg" type="button" style="margin-left: 10px" data-toggle="modal" data-target="#l">-->
                            <!--查询-->
                        <!--</button>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->

    <!--<div class="modal fade" id="jj">-->
        <!--<div class="modal-dialog" style="width:300px;">-->
            <!--<div class="modal-content">-->
                <!--<div class="modal-header">-->
                    <!--<button class="close" data-dismiss="modal">&times;</button>-->
                    <!--<span>存钱</span>-->
                <!--</div>-->
                <!--<form class="form-horizontal" action="">-->
                    <!--<div class="modal-body">-->
                        <!--<div class="form-group">-->
                            <!--<label class="control-label col-xs-2">金额</label>-->
                            <!--<div class="col-xs-9">-->
                                <!--<div class="input-group">-->
                                <!--<span class="input-group-addon">-->
                                    <!--<span class="glyphicon glyphicon-user"></span>-->
                                <!--</span>-->
                                    <!--<input type="text" class="form-control" required="required" name="login">-->
                                <!--</div>-->
                            <!--</div>-->
                        <!--</div>-->
                    <!--</div>-->
                <!--</form>-->
                <!--<div class="modal-footer">-->
                    <!--<span>-->
                        <!--<input type="button" class="btn btn-primary" value="确定" id="存钱">-->
                    <!--</span>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
<script>
    var a = document.getElementById('注册');
    var b = document.getElementById('登录');
    var dl = $('.dl');
    var m = $('.m');//恭喜
    var n = $('.n');//重复
    function f(n){
        if(n=="注册"){
            a.value="确定注册";
            a.id="确定";
            dl.html("注册ATM");
            b.value="返回";
        }
        if(n=="确定"){
            var from = $('form');
            $.ajax({
                url:"<?php echo U('Kirito/index');?>",
                data:from.serialize(),
                type:"post",
//                dataType:"json",
                success:function (resp){
//                    m.html(resp);
//                    m.show();
//                    n.hide();
                },
                error:function(xhr,e){
//                    alert(e);
//                    m.hide();
//                    n.show();
                }
            });
        }
    }

    function l(u){
        if(u=="登录"){
            var from = $('form');
            $.ajax({
                url:"<?php echo U('Kirito/f');?>",
                data:from.serialize(),
                type:"post",
                dataType:"json",
                success:function (resp){
                    console.log(resp)
                },
                error:function(xhr,e){
                    console.log(e);
                }
            });
        }
    }
</script>
</body>
</html>